package org.example.adminbackend.client;

import org.example.adminbackend.common.Result;
import org.example.pojo.Ad;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 广告服务Feign客户端
 */
@FeignClient(name = "ad-service", path = "/api/ads", contextId = "adServiceClient")
public interface AdServiceClient {

    /**
     * 获取所有广告
     */
    @GetMapping
    Result<List<Ad>> getAllAds();

    /**
     * 根据ID获取广告
     */
    @GetMapping("/{id}")
    Result<Ad> getAdById(@PathVariable("id") Integer id);

    /**
     * 创建广告
     */
    @PostMapping
    Result<Ad> createAd(@RequestBody Ad ad);

    /**
     * 更新广告
     */
    @PutMapping("/{id}")
    Result<Ad> updateAd(@PathVariable("id") Integer id, @RequestBody Ad ad);

    /**
     * 删除广告
     */
    @DeleteMapping("/{id}")
    Result<String> deleteAd(@PathVariable("id") Integer id);
}